namespace Brjnk.GpxExplorer.WPF
{
    using System;
    using System.Windows.Input;

    /// <summary>
    /// </summary>
    public class StringToClipboardCommand : ICommand
    {
        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        protected void OnCanExecuteChanged()
        {
            if (CanExecuteChanged != null) CanExecuteChanged(this, EventArgs.Empty);
        }

        public void Execute(object parameter)
        {
            string str = parameter.ToString();

            if (!string.IsNullOrEmpty(str))
            {
                App.Instance.Workspace.Clipboard.SetText(str);
            }
        }
    }
}